package oo;

import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

import javax.faces.event.ActionEvent;
import javax.faces.event.ValueChangeEvent;
import javax.faces.model.SelectItem;

public class lista_oceny {

	private boolean widocznosc;
	
	public boolean isWidocznosc() {
		return widocznosc;
	}
	public void setWidocznosc(boolean widocznosc) {
		this.widocznosc = widocznosc;
	}
	private static Map<String,Object> color2Value;
	static{
		color2Value = new LinkedHashMap<String,Object>();
		/*for(double o=2.0,i=1;i<8;o+=0.5,i++)
			color2Value.put(String.valueOf(o), String.valueOf(o));*/
		color2Value.put("2","2.0");
		color2Value.put("3.0(dst)","3.0");
		color2Value.put("3.5(dstplus)","3.5");
		color2Value.put("4.0(db)","4.0");
		color2Value.put("4.5(dbplus)","4.5");
		color2Value.put("5.0(bdb)","5.0");
		/*color2Value.put("Color2 - Green", "Green");
		color2Value.put("Color3 - Blue", "Blue");*/
		
	}
	public Map<String,Object> getFavColor2Value() {
		return color2Value;
	}
	private List<SelectItem> 
		studentwybrany,studentbezoceny= new ArrayList<SelectItem>();
	private List<String> listValues  =new ArrayList<String>();
	private String ocena,favColor2,value,kolor;
	
	public String getKolor() {
		return kolor;
	}
	public void setKolor(String kolor) {
		this.kolor = kolor;
	}
	public List<String> getListValues() {
		return listValues;
	}
	public void setListValues(List<String> listValues) {
		this.listValues = listValues;
	}
	public String getValue() {
		return value;
	}
	public void setValue(String value) {
		this.value = value;
	}
	public String getFavColor2() {
		return favColor2;
	}
	
	public void setFavColor2(String favColor2) {
		this.favColor2 = favColor2;
	}
	public String getOcena() {
		System.out.println("o1");
		return ocena;
	}
	public void setOcena(String ocena) {
		System.out.println("o2");
		this.ocena = ocena;
	}
	
	public List<SelectItem> getStudentwybrany() {
		return studentwybrany;
	}
	public void setStudentwybrany(List<SelectItem> studentwybrany) {
		this.studentwybrany = studentwybrany;
	}
	
	public List<SelectItem> getStudentbezoceny() {
		return studentbezoceny;
	}
	public void setStudentbezoceny(List<SelectItem> studentbezoceny) {
		this.studentbezoceny = studentbezoceny;
	}
	public lista_oceny() {
		super();
		loadDataList();
	}
 	public void change_(ValueChangeEvent event){
 		String f=event.getNewValue().toString().replace("[", "");
 		f=f.toString().replace("]", "");
 		String[] tab=f.split(", ");
 		for(int w=0;w<tab.length;w++)
 			System.out.println(tab[w]);
	}
 	public void doSomething(){
 		System.out.println(favColor2);
 		if(favColor2.equals("Green")){
 			kolor="red";
 			System.out.println("c"+getKolor());
 		}
 		else{
 			kolor="green";
 			System.out.println("z"+getKolor());
 		}
 	}
 	public  void loadDataList() {
 		studentbezoceny.add(new SelectItem("hyski","z2012-Hyski Mateusz"));
 		studentbezoceny.add(new SelectItem("hyski2","z2012-dodatkowy"));
    }  
}
